from simpy import Store, Environment

from x_pc.core.unit import Unit


class ZBSX(Unit):
    """
    201 栈板上下架接泊口
    栈板上下(ZBSX)
    """
    # 资源 (使用Store模拟出货口的占用，先占用后出库)
    store: Store = None

    def __init__(self, env: Environment, name: str, kwargs):
        super().__init__(env, name, kwargs)
        self.store = Store(env, self.cache_nums())

    def is_full(self):
        """
        缓存是否已满
        :return:
        """
        return len(self.store.items) == self.cache_nums()

    @staticmethod
    def device_type() -> int:
        return 201
